#ifndef __LINKAGE_CONDITION_TABLE_H__
#define __LINKAGE_CONDITION_TABLE_H__

#include <stdint.h>


//
typedef struct _LINKAGE_CONDITION{
    int64_t  id;          //联动条件ID
    int64_t  linkageID;   //联动规则ID
    int64_t  deviceID;    //设备ID
    int64_t  pointID;     //测点ID
    char     op[16];      //条件操作符
    char     value[32];   //值
    struct _LINKAGE_CONDITION* prev;
    struct _LINKAGE_CONDITION* next;
}T_LINKAGE_CONDITION;

/**
 * @brief 测点模型
 */
typedef struct _LINKAGE_CONDITION_LIST{
    int  count;
    T_LINKAGE_CONDITION* tail;
    T_LINKAGE_CONDITION* head;
}T_LINKAGE_CONDITION_LIST;


extern void dbLinkageConditionInit();
extern int  createLinkageConditionTable();
extern int  insertLinkageCondition(T_LINKAGE_CONDITION* condition);
extern int  replaceLinkageCondition(T_LINKAGE_CONDITION* condition);
extern int  deleteLinkageCondition(T_LINKAGE_CONDITION* condition);
extern int  selectLinkageCondition(const char* sql, T_LINKAGE_CONDITION_LIST* conditionList);



#endif // __LINKAGE_CONDITION_TABLE_H__